package com.wlyy.bcwlw.sys.operationlog.dao;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.rework.joss.persistence.convention.BaseDao;
import com.wlyy.bcwlw.sys.operationlog.entity.UserOperationLogDTO;

/**
 * 
 * @ClassName. SysUserOperationLogDAO
 * @Description. 操作日志dao
 * @author zhangyang
 * @date 2016年5月19日 下午5:21:26
 * @version V1.0
 */
@Repository
public class UserOperationLogDAO extends BaseDao<UserOperationLogDTO, Long> {
	
	public Integer queryCountLogsByCriteria(Map<String,Object> paramMap){
		return this.sqlSessionTemplate.selectOne(getMapperMethodId("queryCountLogsByCriteria"),paramMap);
	}
	
	public List<UserOperationLogDTO> queryLogsByCriteria(Map<String,Object> map,Integer offset,Integer limit){
		if(StringUtils.isEmpty((String)map.get("orderby"))){
			map.put("orderby","g.scrq desc");
		}else{
			map.put("orderby", map.get("orderby")+",g.scrq desc");
		}
		map.put("offset",offset);
		map.put("limit",limit);
		return this.sqlSessionTemplate.selectList(getMapperMethodId("queryLogsByCriteria"),map);
	}

}
